/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Interfata;

import java.awt.Color;
import java.awt.event.ActionEvent;

/**
 * Clasa abstracta ce identifica responsabilul pentru executie
 * @author AlinT
 */
public abstract class Complet {

    public abstract void execute();

    /**
     * Functia primeste date de la utilizator si in functie de acestea creaza
     * obiectul responsabil cu tratarea cazului
     * @param fct functia introdusa de utilizator
     * @param x valoarea lui x introdusa de utilizator
     * @param event butonul apasat
     * @return subclasa ce se va ocupa de executie
     */
    public static Complet doJob(String fct, String x, ActionEvent event){
        System.out.println(event);
        if(event.toString().indexOf("Calcul")!=-1 && (fct.equals("") || x.equals(""))){
           return new Incomplet(fct, x);}
        else if (event.toString().indexOf("Calcul")!=-1 && !fct.equals("") && !x.equals("")){
            return new CreazaCopac(fct, Double.parseDouble(x));}
        else if(event.toString().indexOf("XML")!=-1 && !fct.equals("")){
            return new CreazaXML();}
        else 
            return new Incomplet(fct, x);}
    }

